.PHONY : all phonegap html

html : index.html BreedingPairDetail.html BreedingPairList.html BreedingPairSelect.html Calendar.html ColonyDetail.html ColonyMenu.html ExperimentDetail.html ExperimentGroupDetail.html ExperimentGroupView.html ExperimentView.html GenotypeDetail.html GenotypeList.html ImportExport.html InterventionDetail.html InterventionList.html LitterDetail.html LitterList.html LitterView.html MouseDetail.html MouseList.html TeamMemberEdit.html TeamMemberList.html About.html

%.html : %.body
	cat common.pre common.min.head $^ common.post > $@

#all : js/Model.sql.js

js/Model.sql.js : sql/gen.sql sql/Model.sql.js.header
	cat sql/gen.sql | tr \' \" | sed -r "s/.*/agr.sql.init.push(\'&\');/" | cat sql/Model.sql.js.header - > js/Model.sql.js

sql/gen.sql : sql/Model.sql sql/sample.sql
	-rm sql/Model.db
	cat $^ | tee sql/temp.sql | sqlite3 sql/Model.db | sed '1,2d;$$d'> $@
	ex -s $@ -c '%s/\([^;]\)\n/\1 /eg' -c '%s/\nEND;/ END;/eg' -c wq

phonegap : dist.zip

css_files = css/fullcalendar.css css/jquery.mobile-1.1.0.min.css

lib_files = lib/fullcalendar.min.js lib/jquery-1.7.2.min.js lib/jquery.mobile-1.1.0.min.js

dist.zip : config.xml $(wildcard *.html) $(wildcard js/*.js) $(css_files) $(lib_files) $(wildcard css/images/*.png) $(wildcard icons/*.png)
	zip -r $@ $^
